﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class SwitchInvoke : MonoBehaviour
{
    public UnityEvent on;
    public UnityEvent off;

    public bool isOn = false;

    public void Switch()
    {
        Invoke();
        isOn = !isOn;
    }

    public void Invoke()
    { 
        if (isOn)
        {
            on?.Invoke();
        }
        else
        {
            off?.Invoke();
        }
    }
}
